<?php

namespace App\Admin\Forms\Tenant;

use App\Wen\Utils\FieldUtils;
use App\Wen\Utils\Settings;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;

class PayModelCodeForm3 extends Form implements LazyRenderable
{
    use LazyWidget;

    public function handle(array $input)
    {
        for ($i = 21; $i <= 30; $i++){
            if(isset($input['mini_pay_code_'.$i])){
                Settings::set('mini_pay_code_'.$i, $input['mini_pay_code_'.$i], true);
            }
        }

        return $this->response()
            ->success('配置成功')
            ->refresh();
    }

    public function form()
    {
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费21：站内转发+转发好友</div>';
            }, '');
            $this->image('mini_pay_code_21', '付费21')->help('<a href="https://img.mini.minisns.cn/2023/10/29/60b4cf33768e86b1dc09d79d51ee25cc.png" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_21', 'https://img.mini.minisns.cn/2023/10/29/60b4cf33768e86b1dc09d79d51ee25cc.png'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费22：暗黑模式</div>';
            }, '');
            $this->image('mini_pay_code_22', '付费22')->help('<a href="https://img.mini.minisns.cn/2023/10/29/7a984bbb2df19ac2f506bf504947eae5.png" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_22', 'https://img.mini.minisns.cn/2023/10/29/7a984bbb2df19ac2f506bf504947eae5.png'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费23：商品用户分账</div>';
            }, '');
            $this->image('mini_pay_code_23', '付费23')->help('<a href="https://img.mini.minisns.cn/2023/08/11/93e6430f6ffca8205bc1c50e2429d3bc.png" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_23', 'https://img.mini.minisns.cn/2023/08/11/93e6430f6ffca8205bc1c50e2429d3bc.png'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费24：上下滑动视频</div>';
            }, '');
            $this->image('mini_pay_code_24', '付费24')->help('<a href="https://img.mini.minisns.cn/2023/08/27/f33f453d12705f1ce41597f1f13112ac.png" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_24', 'https://img.mini.minisns.cn/2023/08/27/f33f453d12705f1ce41597f1f13112ac.png'));
//            $this->image('mini_pay_code_25', '付费25：宠物领养系统')->help('<a href="https://img.mini.minisns.cn/2023/10/29/b756ee75e9b7ba7823f6797be8c0931a.png" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_25', 'https://img.mini.minisns.cn/2023/10/29/b756ee75e9b7ba7823f6797be8c0931a.png'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费26：抽奖获得商品</div>';
            }, '');
            $this->image('mini_pay_code_26', '付费26')->help('<a href="https://img.mini.minisns.cn/2023/09/05/9a59b7cec7b43d18ec96456b5ddace13.png" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_26', 'https://img.mini.minisns.cn/2023/09/05/9a59b7cec7b43d18ec96456b5ddace13.png'));
            $this->html(function () {
                return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">付费27：发布视频号视频+直播</div>';
            }, '');
            $this->image('mini_pay_code_27', '付费27')->help('<a href="https://img.mini.minisns.cn/2023/10/29/8517d17169a01fdb609d1b079408c10d.png" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_27', 'https://img.mini.minisns.cn/2023/10/29/8517d17169a01fdb609d1b079408c10d.png'));
//            $this->image('mini_pay_code_28', '付费28：发布视频号视频+直播')->help('<a href="https://img.mini.minisns.cn/2023/10/29/8517d17169a01fdb609d1b079408c10d.png" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_28', 'https://img.mini.minisns.cn/2023/10/29/8517d17169a01fdb609d1b079408c10d.png'));
            $this->image('mini_pay_code_30', '付费30')->help('<a href="https://img.mini.minisns.cn/2024/01/22/1c6966ad4a85a7062c4ee476c1623d9d.png" target="_blank">点击下载默认图</a>')->url('files/uploads')->uniqueName()->autoUpload()->default(Settings::get('mini_pay_code_30', 'https://img.mini.minisns.cn/2024/01/22/1c6966ad4a85a7062c4ee476c1623d9d.png'));
    }
}
